<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateHeaderMessageReadedsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('header_message_readeds', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('msg_id')->default(0)->comment('消息ID');
            $table->tinyInteger('status')->default(1)->comment('状态1已读 2未读');
            $table->integer('user_id')->default(0)->comment('用户ID');
            $table->tinyInteger('type')->default(1)->comment('消息类型 1公告');
            $table->timestamps();
            $table->index(['msg_id', 'user_id']);
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('header_message_readeds');
    }
}
